using NUnit.Framework;
using RMH.DataAccess;
using RMH.UnitTests;
using RMH.Web;


namespace RMH.IntegrationTests.Repository
{
    /// <summary>
    /// Make sure you call base establish context!
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class TransactionalRepositoryBase<T> : base_test where T : IRepository
    {
        protected T repository;

        // TODO: figure out how to not require this call.
        public override void establish_context()
        {
            repository = Container.Resolve<T>();
            repository.BeginTransaction();
        }

        [TestFixtureTearDown]
        public void TearDown()
        {
            repository.RollbackTransaction();
        }
    }
}